<?php
class UserController {

    /**
     * 登录展示页
     */
    public function login() {
        $input = $this->getInput['get'];
        $data = array();
        if(isset($input['error'])&&!empty($input['error'])) {
            $data['error']['msg'] = ErrorLib::getErrorMsg(SafeLib::decryptErrorCode($input['error']));
        }
        return array(
            'tpl' => 'user/login',
            'data' => $data,
        );
    }

    /**
     * 登录处理页
     */
    public function loginSubmit() {
        //密码错误，302返回登录页
        $http = array(
            'uri' => '/user/login',
            'status_code' => 302,
            'params' => array(
                'error' => SafeLib::encryptErrorCode(1),
            ),
        );
        throw new PageExceptionLib($http);
        return array(
            'tpl' => 'login',
            'data' => $data,
        );
    }
}
?>
